﻿using NB.MGJ.Common.MVC;
using NB.MGJ.Model;
using NB.MGJ.Service.Origins;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace NB.MGJ.Web.Controllers
{
    public class AuthModuleController : BaseController
    {
        private OriginsAuthModuleService _OriginsAuthModuleService;
        public AuthModuleController()
        {
            _OriginsAuthModuleService = new OriginsAuthModuleService();
        }



        public ActionResult AuthModuleDelete (int moduleId)
        {
          var result=_OriginsAuthModuleService.Del(moduleId);
          return Json(result);
        }






        public ActionResult AuthModuleSave(Origins_AuthModule model )
        {
            model.ChangeDate = DateTime.Now;
            model.ChangeLoginId = LogOnUser.UserID;
            model.ChangeLoginName = LogOnUser.RealName;
            model.ViewDel = 0;
    
            if (model.Id > 0)
            {
               var  result = _OriginsAuthModuleService.Update(model);
               return Json(result);
            }
            else
            {
              var   result = _OriginsAuthModuleService.Add(model);
              return Json(result);
            }
     
        }

        public ActionResult GetAuthModuleListByAuthId(int Id)
        {
            var list = _OriginsAuthModuleService.GetAuthModuleListByAuthId(Id);
            return Json(list);
        }


	}
}